package cn.edu.scau.cmi.dengshixin.mutipleton;

import java.util.ArrayList;

public class Marshal {
	
	public static final int count = 5;
	private static ArrayList<Marshal> list = new ArrayList<Marshal>();
	private String name;
	
	private Marshal(String name) {
		this.name = name;
	}
	
	static public Marshal getInstance(String name) {
		if(list.size() == count) return null;
		for(int i=0; i<list.size(); i++) {
			if(name.equals(list.get(i).getName())) {
				return list.get(i);
			}
		}
		Marshal marshal = new Marshal(name);
		list.add(marshal);
		return marshal;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}
	
}
